package net.huashitong.supervision.task.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.supervision.task.dao.ReadDocDao;
import net.huashitong.supervision.task.entity.ReadDocEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: ling
 * Date: 2019/12/26
 * Time: 16:13
 * To change this template use File | Settings | File Templates.
 * Description:
 */
@Service
public class ReadDocService extends StringPKService<ReadDocEntity> {
    @Autowired
    private ReadDocDao readDocDao;
    @Autowired
    private SysTableService tableService;
    @Override
    protected BaseDao<ReadDocEntity, String> getDao() {
        return readDocDao;
    }
    @Override
    protected void beforeSave(ReadDocEntity obj) {
        obj.setSysId(tableService.updateMaxSysId("t_read_doc", null));
    }

    public List<ReadDocEntity> getByCreateUser(String createUserId) {
        return readDocDao.getByCreateUser(createUserId);
    }

    public List<ReadDocEntity> getByLeaderId(String leaderId) {
        return readDocDao.getByLeaderId(leaderId);
    }
}
